﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.IO;

namespace _7._19
{
    class Program
    {
        static int[] Mus1()
        {
            Console.WriteLine("Введите первый массив");
            int [] arr1=new int [4];
            for (int i = 0; i < 4;i++ )
            {
                Console.Write("a[{0}] = ",i);
                arr1[i] = int.Parse(Console.ReadLine());
            }
            return arr1;
        }
        static int[] Mus2()
        {
            Console.WriteLine("Введите первый массив");
            int[] arr2 = new int[4];
            for (int i = 0; i < 4; i++)
            {
                Console.Write("a[{0}] = ", i);
                arr2[i] = int.Parse(Console.ReadLine());
            }
            return arr2;
        }
        static  ArrayList Set3(int[] arr1, int[] arr2)
        {
            ArrayList str = new ArrayList();
            for (int i = 0; i < arr1.Length; i++)
            {
                int k = 0;
                while (arr1[i] != arr2[k])
                {
                    k++;
                    if (k == arr2.Length)
                    {
                        str.Add(arr1[i]);
                        break;
                    }
                }
            }
            for (int i = 0; i < arr2.Length; i++)
            {
                int k = 0;
                while (arr2[i] != arr1[k])
                {
                    k++;
                    if (k == arr1.Length)
                    {
                        str.Add(arr2[i]);
                        break;
                    }
                }
            }
            return str;
        }
        static void Set4(ArrayList str)
        {
            foreach (int s in str)
            {
                Console.Write(s + " ");
            }
        }
        static void Main(string[] args)
        {
            int[] arr1 = Mus1();
            int[] arr2 = Mus2();
            ArrayList str;
            str = Set3(arr1, arr2);
            Set4(str);
        }
    }
}
